 private void btnDelete_Click(object sender, EventArgs e){
            MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
            DialogResult dr = MessageBox.Show("确定要删除吗?", "确定", messButton);
            if (dr == DialogResult.OK){
                 try{
                     using (SqlConnection conn = new SqlConnection(connStr)){
                         conn.Open(); //打开数据库连接
                         SqlCommand comm = conn.CreateCommand();
                         comm.CommandText = "delete from Student where Id = @Id";
                         comm.Parameters.AddWithValue("@Id", tbId.Text);
                         comm.ExecuteNonQuery();
                         MessageBox.Show("删除成功！");
                         DataBind();
                     }
                 }catch (Exception ex){
                     MessageBox.Show("删除失败！" + ex.Message);
                 }
            }
        }